// import { ref, computed } from "vue"
import { defineStore } from "pinia"
import storage from "@/utils/storage"
export const useTokenStore = defineStore("token", () => {
  const token = ref(storage.get("token") || "")
  const userinfo = ref<any>(storage.get("userinfo") || {})
  const setToken = (data: string) => {
    token.value = data
  }
  const getToken = computed(() => {
    return token.value
  })
  const setUserInfo = (data: any) => {
    userinfo.value = data
  }
  const getUserInfo = computed(() => {
    return userinfo.value
  })
  {
    true
  }
  return { token, setToken, getToken, userinfo, setUserInfo, getUserInfo }
})
